/*******************************************************************************
 * Copyright 2009 OmniDroid - http://code.google.com/p/omnidroid 
 *  
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 *  
 *     http://www.apache.org/licenses/LICENSE-2.0 
 *     
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 *******************************************************************************/
package edu.nyu.cs.omnidroid.tests;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;
import edu.nyu.cs.omnidroid.util.*;

/**
 * Test the Application Configuration File
 * 
 * 
 */
public class TestAppConfig extends Activity {

  /*
   * (non-Javadoc)
   * 
   * @see android.app.Activity#onCreate(android.os.Bundle)
   */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // FIXME: This needs to be pulled from the other applications
    super.onCreate(savedInstanceState);
    AGParser ag = new AGParser(this.getApplicationContext());
    writeConfig(ag);

    Toast.makeText(getApplicationContext(), "Population Test App Config File", 5).show();
    this.finish();

  }

  /* Visible for testing */
  public static void writeConfig(AGParser ag) {
    ag.delete_all();
    ag.write("Application:Test Application");
    ag.write("PkgName:edu.nyu.cs.omnidroid");
    ag.write("ListenerClass:edu.nyu.cs.omnidroid.external.catcherapp.SMSListener");
    ag.write("EventName:Contact_Saved,Contact Saved");
    ag.write("Filters:S_Name,S_Ph_No,Text");
    ag.write("EventName:Contact_Updated,Contact Updated");
    ag.write("Filters:S_Name,S_Ph_no,Text");
    ag.write("ActionName:Display_Contact,Display Contact");
    ag.write("URIFields:SENDER PHONE NUMBER,TEXT");
    ag.write("ContentMap:");
    ag.write("S_Name,CONTACT NAME,STRING");
    ag.write("S_Ph_No,SENDER PHONE NUMBER,INT");
    ag.write("Text,TEXT,STRING");

    ag.write("Application:SMS");
    ag.write("PkgName:edu.nyu.cs.omnidroid");
    ag.write("ListenerClass:edu.nyu.cs.omnidroid.external.catcherapp.SMSCatcher");
    ag.write("EventName:SMS_RECEIVED,SMS RECEIVED");
    ag.write("Filters:address");
    ag.write("EventName:SMS_SEND,SENT SMS");
    ag.write("Filters:address,body");
    ag.write("ActionName:SMS_SEND,SEND SMS");
    ag.write("URIFields:SENDER PHONE NUMBER,TEXT");
    ag.write("ContentMap:");
    // ag.write("S_Name,SENDER NAME,STRING");
    // ag.write("R_Name,RECEIVER NAME,STRING");
    ag.write("address,SENDER PHONE NUMBER,INT");
    ag.write("r_phone_no,RECEIVER PHONE NUMBER,INT");
    ag.write("body,TEXT,STRING");
    // ag.write("Location,SMS Number,INT");

    ag.write("Application:Calllog");
    ag.write("PkgName:edu.nyu.cs.omnidroid");
    ag.write("ListenerClass:edu.nyu.cs.omnidroid.external.catcherapp.SMSListener");
    ag.write("EventName:PHONE_STATE,CALL RECEIVED");
    ag.write("Filters:_id");
    ag.write("EventName:SMS_SEND,SENT SMS");
    ag.write("Filters:address,body");
    ag.write("ActionName:SMS_SEND,SEND SMS");
    ag.write("URIFields:SENDER PHONE NUMBER,TEXT");
    ag.write("ContentMap:");
    // ag.write("S_Name,SENDER NAME,STRING");
    // ag.write("R_Name,RECEIVER NAME,STRING");
    ag.write("address,SENDER PHONE NUMBER,INT");
    ag.write("r_phone_no,RECEIVER PHONE NUMBER,INT");
    ag.write("body,TEXT,STRING");
    // ag.write("Location,SMS Number,INT");

    ag.write("Application:System");
    ag.write("EventName:android.intent.action.TIME_SET,TIME CHANGED");
    ag.write("EventName:android.intent.action.SCREEN_OFF,SCREEN OFF");
    ag.write("EventName:android.intent.action.SCREEN_ON,SCREEN ON");
    ag.write("EventName:android.intent.action.DATE_CHANGED,DATE CHANGED");
    ag.write("EventName:android.intent.action.NEW_OUTGOING_CALL,NEW OUTGOING CALL");
    ag.write("EventName:android.intent.action.WALLPAPER_CHANGED,WALLPAPER CHANGED");
    ag.write("EventName:android.intent.action.CAMERA_BUTTON,CAMERA CLICK");
    ag.write("EventName:android.intent.action.REBOOT,REBOOT ");
    ag.write("ActionName:android.intent.action.TIME_SET,TIME CHANGED");
    ag.write("ActionName:android.intent.action.SCREEN_OFF,SCREEN OFF");
    ag.write("ActionName:android.intent.action.SCREEN_ON,SCREEN ON");
    ag.write("ActionName:android.intent.action.DATE_CHANGED,DATE CHANGED");
    ag.write("ActionName:android.intent.action.NEW_OUTGOING_CALL,NEW OUTGOING CALL");
    ag.write("ActionName:android.intent.action.WALLPAPER_CHANGED,WALLPAPER CHANGED");
    ag.write("ActionName:android.intent.action.CAMERA_BUTTON,CAMERA CLICK");
    ag.write("ActionName:android.intent.action.REBOOT,REBOOT ");
  }
}